package model;

import java.util.ArrayList;

public class PosterminalList {
	ArrayList<Posterminal> poss = new ArrayList<Posterminal>();
	private String logs = "";
	private int operationCount = 0;
	
	public PosterminalList() {
		
	}
	
	public PosterminalList(String test) {
		Posterminal posOne = new Posterminal(1, "lurkmore 42");
		Posterminal posTwo = new Posterminal(2, "lurkmore 72");
		Posterminal posThree = new Posterminal(3, "lurkmore 27");
		poss.add(posOne);
		poss.add(posTwo);
		poss.add(posThree);
	}
	
	public void addPosterminal(Posterminal pos) {
		logs("addPosterminal \n");
		poss.add(pos);		
	}

	public void removePosterminal(Posterminal pos) {
		logs("removePosterminal \n");
		poss.remove(pos);		
	}
	
	public int getPosterminalsCount() {
		return poss.size();
	}

	public String getLogs() {
		return logs;
	} 
	
	public void logs(String logs) {
		operationCount++;
		this.logs += logs;
	}
		
	public int getOperationsCount() {
		return operationCount;
	}
	
	public Posterminal getPosterminal(int id){
		return poss.get(id);
	}

	public void updatePosterminalAddress(Posterminal posterminal, String address) {
		poss.get(poss.indexOf(posterminal)).setAddress(address);

	}

	public String getPosterminalAddress(Posterminal posterminal) {
		return posterminal.getAddress();
	}

	public ArrayList<Posterminal> getPosterminals() {
		return poss;
	}
}

